//
//  ZBItemCell.m
//  ZBCooking
//
//  Created by xzb on 2019/2/18.
//  Copyright © 2019 xzb. All rights reserved.
//

#import "ZBItemCell.h"

@interface ZBItemCell ()
@property (nonatomic, strong) NSDictionary *info;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIView *bgView;

@end
@implementation ZBItemCell

- (void)awakeFromNib
{
    [super awakeFromNib];
    
    self.bgView.layer.cornerRadius  = 10;
    self.bgView.layer.shadowColor  = [UIColor blackColor].CGColor;
    self.bgView.layer.shadowOffset  = CGSizeMake(0, 5);
    self.bgView.layer.shadowOpacity = 0.3f;
    self.bgView.layer.shadowRadius  = 10.0f;
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSString *target = [self.info zb_safeStringValueForKey:@"target" defaultValue:@""];
    if (target.length < 0) {
        [ZBToast showToast:@"target 有误"];
    }
    [ZBRouter openURL:@"xzb/webview" withUserInfo:@{
                                                    @"url" :target
                                                    } completion:nil];
}
#pragma mark - BDCellInfoProtocol

- (void)loadData:(id)data
{
    self.info = data;
    self.titleLabel.text = data[@"title"];
}

+ (CGFloat)cellHeight:(id)model
{
    return 44;
}

+ (CGSize)itemSize:(id)data
{
    return CGSizeMake(CGRectGetWidth([UIScreen mainScreen].bounds), 50);
}
@end
